//
//  ZHPopupMenu.h
//  ZHPopupMenu
//
//  Created by Basic on 16/4/5.
//  Copyright © 2016年 zhihan. All rights reserved.
//  弹出菜单

#import <UIKit/UIKit.h>
#import "ZHPopupMenuItemModel.h"
#import "ZHPopupMenuPublic.h"

NS_ASSUME_NONNULL_BEGIN
@class ZHPopupMenu;
@protocol ZHPopupMenuDelegate <NSObject>
@optional
/**
 选择菜单的item事件
 @param view view description
 @param selectedIndex 选择的item索引
 @param selectedItem 选择的item
 */
- (void)zhPopupMenu:(ZHPopupMenu *)view didSelectedItem:(NSInteger )selectedIndex selectedItem:(ZHPopupMenuItemModel *)selectedItem;

/**
 消失回调
 @param view view description
 */
- (void)zhPopupMenuDismiss:(ZHPopupMenu *)view;
@end


@interface ZHPopupMenu : NSObject
/// 背景色，默认nil 设置显示
@property (nonatomic, strong) UIColor *backgroundColor;
/// 背景色，默认黑色
@property (nonatomic, strong) UIColor *menuBgColor;
/// title，默认白色
@property (nonatomic, strong) UIColor *menuTitleColor;
/// title，字体默认system:14
@property (nonatomic, strong) UIFont *menuTitleFont;
/// 阴影色，默认不设置
@property (nonatomic, strong) UIColor   *menuShadowColor;
/// 菜单宽度，默认 130
@property (nonatomic, assign) CGFloat menuWidth;
/// 菜单高度，默认 44
@property (nonatomic, assign) CGFloat lineHeight;
/// 菜单x offset，默认0，和sender 居中，不偏移
@property (nonatomic, assign) CGFloat offsetX;
/// 菜单y offset，默认0，和sender 居中，不偏移
@property (nonatomic, assign) CGFloat offsetY;
/// 是否隐藏箭头，默认 false
@property (nonatomic, assign) BOOL hideArrow;
/// 箭头x偏移，默认0
@property (nonatomic, assign) CGFloat arrowOffsetX;
/// 箭头朝向，默认 unkown，内部自动根据sender 位置判断
@property (nonatomic, assign) ZHPopupMenuDirection direction;
/// 事件源 point，默认 {0,0}（和senderView、senderEvent可选）
@property (nonatomic, assign) CGPoint senderPoint;
/// 事件源 view，默认nil
@property (nonatomic, strong, nullable) UIView *senderView;
/// 事件源 event，默认nil
@property (nonatomic, strong, nullable) UIEvent *senderEvent;
/// 容器 view，默认nil，即使用最顶层的vc view
@property (nonatomic, strong, nullable) UIView *containerView;
/// 内容 view
@property (nonatomic, strong, readonly) UIView *contentView;
/// delegate
@property (nonatomic, weak, nullable) id<ZHPopupMenuDelegate> delegate;
//MARK: - system
+ (instancetype )sharedMenu;
    
//MARK: - public

/**
 是否在显示

 @return return value description
 */
+ (BOOL)isShowing;

/**
 显示弹出菜单

 @param menuArray menuArray
 */
- (void)showMenu:(NSArray<ZHPopupMenuItemModel *> *)menuArray;

/**
 *  关闭
 */
+ (void)dismiss;

@end


NS_ASSUME_NONNULL_END
